<?php
  if(!$_COOKIE['UserID']){
    HEADER("location:../login.html");
  }
  include "../php/pdo-plus/src/PDO.class.php";
  include "../php/fn.php";
  include "../php/config.php";
  $db=DB::getInstance($database);
  if(isset($_COOKIE['UserID'])){
    $userid=intval($_COOKIE['UserID']);
    $user=$db->query("SELECT * from user where id=?",[$userid]);
    if(!$user){
      header("LOCATION:./login.html");
    }
  }else{
    header("LOCATION:./login.html");
  }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>个人中心</title>
<style type="text/css">
.ys01 {
	font-size: 24px;
}
.ys01 {
	font-size: 36px;
}
.ys01 {
	font-size: 14px;
}
.ys01 {
	font-size: 12px;
}
.ys02 {
	text-align: left;
	font-size: 36px;
}
.ys03 {
	font-size: 24px;
	font-weight: bold;
}
.ys04 {
	color: #F00;
	font-size: 24px;
}
.ys05 {
	font-size: 16px;
}
.ys06 {
	font-size: 14px;
}
.ys04 {
}
.ys04 .ys04 .ys04 {
	text-align: left;
}
</style>
</head>

<body>
<table width="100%" border="0" align="center">
  <tr>
    <th scope="col"><table width="100%" border="0" align="center">
      <tr>
        <th scope="col"></th>
      </tr>
    </table>
      <table width="100%" border="0" align="center">
        <tr>
          <th scope="col"><table width="100%" border="0">
            <tr>
              <th height="450" scope="col"><table width="60%" border="0" align="center">
                <tr>
                  <th scope="col"><table width="1000" border="0" align="center">
                    <tr>
                      <th width="10%" height="40" bgcolor="#FF9966" scope="col"><a href="寓萌-首页.html">首页</a></th>
                      <th width="10%" height="40" bgcolor="#FF9966" scope="col"><a href="list.php">个人中心</a></th>
                      <th width="10%" height="40" bgcolor="#FF9966" scope="col"><a href="">房源管理</a></th>
                      <th height="40" bgcolor="#FF9966" scope="col"><table width="40%" border="0" align="right">
                        <tr>
                          <th bgcolor="#00FFFF" scope="col">房源</th>
                          <th bgcolor="#00FFFF" scope="col">推广</th>
                          <th bgcolor="#00FFFF" scope="col">采购</th>
                          <th bgcolor="#00FFFF" scope="col">融资</th>
                          <th bgcolor="#00FFFF" scope="col">权限</th>
                          <th scope="col">&nbsp;</th>
                        </tr>
                      </table></th>
                      </tr>
                    </table></th>
                  </tr>
              </table>
                <table width="50%" border="1">
                <form action="" id="edituser">
                  <input type="hidden" name="type" value="edituser">
                  <input type="hidden" name="userid" value="<?php echo $user[0]['id'];?>">
                <tr>
                  <th width="20%" height="40" scope="col">头像</th>
                  <th width="40%" height="40" scope="col">
                    <img src="../upload/photos/<?php echo $user[0]['photo'];?>" alt="" class="photo" style="max-width:200px;">
                  </th>
                  <th height="40" scope="col">&nbsp;</th>
                </tr>
                <tr>
                  <th width="20%" height="40" scope="row">用户名</th>
                  <td width="40%" height="40"><?php echo $user[0]['username'];?></td>
                  <td height="40">&nbsp;</td>
                </tr>
                <tr>
                  <th width="20%" height="40" scope="row">昵称</th>
                  <td width="40%" height="40"><label for="textfield"></label>
                    <input name="nickname" type="text" id="nickname" size="30" value="<?php echo $user[0]['nickname'];?>" /></td>
                  <td height="40">&nbsp;</td>
                </tr>
                <tr>
                  <th width="20%" height="40" scope="row">手机号</th>
                  <td width="40%" height="40"><input name="phone" type="text" id="phone" size="30" value="<?php echo $user[0]['phone'];?>" /></td>
                  <td height="40">&nbsp;</td>
                </tr>
                <tr>
                  <th width="20%" height="40" scope="row">邮箱</th>
                  <td width="40%" height="40"><input name="email" type="text" id="email" size="30" value="<?php echo $user[0]['email'];?>" /></td>
                  <td height="40">&nbsp;</td>
                </tr>
                <tr>
                  <th width="20%" height="40" scope="row">信用分</th>
                  <td width="40%" height="40"><?php echo $user[0]['point'];?></td>
                  <td height="40">&nbsp;</td>
                </tr>
                <tr>
                  <th width="20%" height="40" scope="row">验证密码</th>
                  <td width="40%" height="40"><input name="password" type="password" id="password" placeholder="请输入登录密码验证" size="30" /></td>
                  <td height="40">&nbsp;</td>
                </tr>
                <tr>
                  <th height="40" scope="row">&nbsp;</th>
                  <td height="40"><input type="button" name="button" id="submit" value="完成修改" /></td>
                  <td height="40">&nbsp;</td>
                </tr>
                </form>
          </table></th>
            </tr>
          </table></th>
        </tr>
      </table>
      <table width="100%" border="0">
        <tr>
          <th scope="col"><table width="1000" border="0" align="center">
            <tr>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">用户帮助</th>
                </tr>
                <tr>
                  <th scope="row">&nbsp;</th>
                </tr>
              </table>
                <table width="100%" border="0">
                  <tr>
                    <th scope="col">入住指南</th>
                  </tr>
                  <tr>
                    <th scope="row">生活常识</th>
                  </tr>
                  <tr>
                    <th scope="row">常见问题</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table></th>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">商务合作</th>
                </tr>
                <tr>
                  <th scope="row">&nbsp;</th>
                </tr>
              </table>
                <table width="100%" border="0">
                  <tr>
                    <th scope="col">商务合作</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table></th>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">公司信息</th>
                </tr>
                <tr>
                  <th scope="row">&nbsp;</th>
                </tr>
              </table>
                <table width="100%" border="0">
                  <tr>
                    <th scope="col">关于我们</th>
                  </tr>
                  <tr>
                    <th scope="row">联系我们</th>
                  </tr>
                  <tr>
                    <th scope="row">加入我们</th>
                  </tr>
                  <tr>
                    <th scope="row">&nbsp;</th>
                  </tr>
                </table></th>
              <th width="18%" height="200" scope="col"><table width="100%" border="0">
                <tr>
                  <th height="30" class="ys03" scope="col">客服热线</th>
                </tr>
                <tr>
                  <th scope="row"><table width="100%" border="0">
                    <tr>
                      <th scope="col">0311-5555555</th>
                    </tr>
                    <tr>
                      <th scope="row">工作日 09:00-21:00</th>
                    </tr>
                    <tr>
                      <th scope="row">&nbsp;</th>
                    </tr>
                    <tr>
                      <th scope="row">&nbsp;</th>
                    </tr>
                  </table></th>
                </tr>
              </table></th>
              <th height="200" scope="col"><table width="100%" border="1">
                <tr>
                  <th scope="col">APP二维码</th>
                  <th scope="col">公众号二维码</th>
                </tr>
              </table></th>
            </tr>
          </table></th>
        </tr>
      </table>
      <table width="100%" border="0" align="center">
        <tr>
          <th scope="col"><table width="1000" border="0" align="center">
            <tr>
              <th width="20%" height="80" scope="col"><img src="logo.jpg" width="90" height="60" alt="logo" /></th>
              <th height="80" scope="col"><table width="90%" border="0">
                <tr>
                  <th class="ys01" scope="col">寓萌——公寓&amp;中介完美合作平台</th>
                </tr>
                <tr>
                  <th class="ys01" scope="row">本网站所有页面的数据统计均来源于寓萌数据库   联系客服：微信 周一至周日09:00-22:00</th>
                </tr>
              </table></th>
              <th width="15%" height="80" scope="col"><img src="标志.png" width="90" height="60" alt="标志" /></th>
            </tr>
          </table></th>
        </tr>
    </table></th>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<link rel="stylesheet" href="../layui/css/layui.css">
<script src="../layui/layui.js"></script>
<script src="../js/jquery-3.2.1.min.js"></script>
<script>
  $(function(){
    $("#submit").click(function(){
      var formdata=$("#edituser").serializeArray();
      $.ajax({
        type: "post",
        url: "../php/api.php",
        data: formdata,
        dataType: "json",
        success: function (response) {
          location.reload();
        }
      });
    })
  })
</script>
